﻿<AttributeUsage(AttributeTargets.Property, Inherited:=False, AllowMultiple:=True)> _
Public Class NullValidatorAttribute
    Inherits BizBloxValidatorAttribute
    Implements iValidator

    Private m_allowNull As Boolean = True

    Public Sub New(ByVal allowNull As Boolean)
        Me.m_allowNull = allowNull
    End Sub

    Public Overrides Sub Validate(ByVal o As Object) Implements iValidator.Validate
        If (o Is Nothing) And (m_allowNull = False) Then Throw New ArgumentException()
    End Sub
End Class
